\documentclass{article}\usepackage[]{graphicx}\usepackage[]{color}
%% maxwidth is the original width if it is less than linewidth
%% otherwise use linewidth (to make sure the graphics do not exceed the margin)
\makeatletter
\def\maxwidth{ %
  \ifdim\Gin@nat@width>\linewidth
    \linewidth
  \else
    \Gin@nat@width
  \fi
}
\makeatother

\definecolor{fgcolor}{rgb}{0.345, 0.345, 0.345}
\newcommand{\hlnum}[1]{\textcolor[rgb]{0.686,0.059,0.569}{#1}}%
\newcommand{\hlstr}[1]{\textcolor[rgb]{0.192,0.494,0.8}{#1}}%
\newcommand{\hlcom}[1]{\textcolor[rgb]{0.678,0.584,0.686}{\textit{#1}}}%
\newcommand{\hlopt}[1]{\textcolor[rgb]{0,0,0}{#1}}%
\newcommand{\hlstd}[1]{\textcolor[rgb]{0.345,0.345,0.345}{#1}}%
\newcommand{\hlkwa}[1]{\textcolor[rgb]{0.161,0.373,0.58}{\textbf{#1}}}%
\newcommand{\hlkwb}[1]{\textcolor[rgb]{0.69,0.353,0.396}{#1}}%
\newcommand{\hlkwc}[1]{\textcolor[rgb]{0.333,0.667,0.333}{#1}}%
\newcommand{\hlkwd}[1]{\textcolor[rgb]{0.737,0.353,0.396}{\textbf{#1}}}%
\let\hlipl\hlkwb

\usepackage{framed}
\makeatletter
\newenvironment{kframe}{%
 \def\at@end@of@kframe{}%
 \ifinner\ifhmode%
  \def\at@end@of@kframe{\end{minipage}}%
  \begin{minipage}{\columnwidth}%
 \fi\fi%
 \def\FrameCommand##1{\hskip\@totalleftmargin \hskip-\fboxsep
 \colorbox{shadecolor}{##1}\hskip-\fboxsep
     % There is no \\@totalrightmargin, so:
     \hskip-\linewidth \hskip-\@totalleftmargin \hskip\columnwidth}%
 \MakeFramed {\advance\hsize-\width
   \@totalleftmargin\z@ \linewidth\hsize
   \@setminipage}}%
 {\par\unskip\endMakeFramed%
 \at@end@of@kframe}
\makeatother

\definecolor{shadecolor}{rgb}{.97, .97, .97}
\definecolor{messagecolor}{rgb}{0, 0, 0}
\definecolor{warningcolor}{rgb}{1, 0, 1}
\definecolor{errorcolor}{rgb}{1, 0, 0}
\newenvironment{knitrout}{}{} % an empty environment to be redefined in TeX

\usepackage{alltt}

\usepackage{graphicx}
\usepackage{amsmath}
\usepackage{multicol, calc}
\usepackage[svgnames]{xcolor}
\usepackage{tikz}
\usetikzlibrary{patterns,positioning,babel}
\usepackage[textsize=tiny]{todonotes}
\usepackage[hidelinks]{hyperref}
\usepackage{graphicx, color, framed, alltt}
\usepackage{threeparttable}
\usepackage{natbib}
\usepackage{forest}
\usepackage{tikz-qtree}
\usepackage{listings}
\usepackage{inconsolata}
\usepackage{bm}
\usepackage{cleveref}



\IfFileExists{upquote.sty}{\usepackage{upquote}}{}
\begin{document}

\title{Appendix - Testing the Formulas for Set-Theoretic Multi-Method Research Implemented in R Package SetMethods}

\author{Ioana-Elena Oana and Carsten Q. Schneider \\
	European University Institute and Central European University}

\maketitle
\newpage

\section{Testing Single Case MMR Formulas}
\label{sec:scf}

\subsection{Typical Cases}
\label{sec:typ}

For testing typical cases we first create data in which both the sufficient term and the outcome are above 0.5. We first create three vectors representing a focal conjunct $fct$, a complementary conjunct $cct$, and an outcome $yt$ which take values from 0.6 to 1 in increments of 0.1. We then create a dataframe $hd$ containing all possible combinations between these values, which we subsequently subset for showing only cases above the diagonal ($st \leq yt$) and into two ranks (Rank1: $fct \leq cct$; Rank 2: $fct>cct$).

\begin{knitrout}
\definecolor{shadecolor}{rgb}{0.969, 0.969, 0.969}\color{fgcolor}\begin{kframe}
\begin{alltt}
\hlcom{# Typical cases: Filter: S > 0.5 & Y > 0.5 (S- sufficient term, Y- outcome)}

\hlstd{fct} \hlkwb{<-} \hlkwd{round}\hlstd{(}\hlkwd{seq}\hlstd{(}\hlnum{0.6}\hlstd{,} \hlnum{1}\hlstd{,} \hlnum{0.1}\hlstd{),} \hlkwc{digits} \hlstd{=} \hlnum{1}\hlstd{)}  \hlcom{#Focal Conjunct}
\hlstd{cct} \hlkwb{<-} \hlkwd{round}\hlstd{(}\hlkwd{seq}\hlstd{(}\hlnum{0.6}\hlstd{,} \hlnum{1}\hlstd{,} \hlnum{0.1}\hlstd{),} \hlkwc{digits} \hlstd{=} \hlnum{1}\hlstd{)}  \hlcom{#Complementary Conjunct}
\hlstd{yt} \hlkwb{<-} \hlkwd{round}\hlstd{(}\hlkwd{seq}\hlstd{(}\hlnum{0.6}\hlstd{,} \hlnum{1}\hlstd{,} \hlnum{0.1}\hlstd{),} \hlkwc{digits} \hlstd{=} \hlnum{1}\hlstd{)}  \hlcom{#Outcome}
\hlstd{hd} \hlkwb{<-} \hlkwd{expand.grid}\hlstd{(fct, cct, yt)}
\hlkwd{colnames}\hlstd{(hd)} \hlkwb{<-} \hlkwd{c}\hlstd{(}\hlstr{"fct"}\hlstd{,} \hlstr{"cct"}\hlstd{,} \hlstr{"yt"}\hlstd{)}
\hlstd{hd}\hlopt{$}\hlstd{st} \hlkwb{<-} \hlkwd{pmin}\hlstd{(hd}\hlopt{$}\hlstd{fct, hd}\hlopt{$}\hlstd{cct)}
\hlstd{hd[,} \hlnum{1}\hlopt{:}\hlnum{4}\hlstd{]} \hlkwb{<-} \hlkwd{round}\hlstd{(hd[,} \hlnum{1}\hlopt{:}\hlnum{4}\hlstd{],} \hlkwc{digits} \hlstd{=} \hlnum{1}\hlstd{)}

\hlcom{# Add columns with values in the formulas:}

\hlstd{hd}\hlopt{$}\hlstd{f8a} \hlkwb{<-} \hlkwd{round}\hlstd{(}\hlkwd{with}\hlstd{(hd, (}\hlkwd{abs}\hlstd{(yt} \hlopt{-} \hlstd{st)} \hlopt{+} \hlstd{(}\hlnum{1} \hlopt{-} \hlstd{st))),} \hlkwc{digits} \hlstd{=} \hlnum{2}\hlstd{)}
\hlstd{hd}\hlopt{$}\hlstd{f8laba} \hlkwb{<-} \hlkwd{as.character}\hlstd{(hd}\hlopt{$}\hlstd{f8a)}
\hlstd{hd}\hlopt{$}\hlstd{f8a} \hlkwb{<-} \hlkwd{round}\hlstd{(hd}\hlopt{$}\hlstd{f8a,} \hlkwc{digits} \hlstd{=} \hlnum{2}\hlstd{)}
\end{alltt}
\end{kframe}
\end{knitrout}

\begin{knitrout}
\definecolor{shadecolor}{rgb}{0.969, 0.969, 0.969}\color{fgcolor}\begin{kframe}
\begin{alltt}
\hlcom{### Rank 1:}
\hlcom{###########}
\hlstd{hd1} \hlkwb{<-} \hlkwd{subset}\hlstd{(hd, (fct} \hlopt{<=} \hlstd{cct)} \hlopt{&} \hlstd{(st} \hlopt{<=} \hlstd{yt))}
\end{alltt}
\end{kframe}
\end{knitrout}

\begin{knitrout}
\definecolor{shadecolor}{rgb}{0.969, 0.969, 0.969}\color{fgcolor}\begin{kframe}
\begin{alltt}
\hlcom{### Rank 2:}
\hlcom{###########}
\hlstd{hd2} \hlkwb{<-} \hlkwd{subset}\hlstd{(hd, (fct} \hlopt{>} \hlstd{cct)} \hlopt{&} \hlstd{(st} \hlopt{<=} \hlstd{yt))}
\end{alltt}
\end{kframe}
\end{knitrout}

Figure~\ref{fig:typfig1} provides the formula test for the typical cases we created located in Rank 1. The complementary conjunct $cct$ is held constant at 1, the focal conjunct is varying from left to right, while the outcome $yt$ is varying from bottom to the top. We can see that as membership in the focal conjunct increases (which since $fct \leq cct$ provides the membership value in the sufficient term as well), the formula value decreases respecting the principle of large membership in the sufficient term. Additionally, as the cases get closer to the diagonal and, thus, the distance between the focal conjunct and the outcome gets smaller, the formula values also get smaller. The best possible typical case is the one in the far upper right corner with formula value 0.

\begin{knitrout}
\definecolor{shadecolor}{rgb}{0.969, 0.969, 0.969}\color{fgcolor}\begin{figure}[t]
\includegraphics[width=\maxwidth]{figure/typfig1-1} \caption[Typical Cases Test Rank 1]{Typical Cases Test Rank 1}\label{fig:typfig1}
\end{figure}


\end{knitrout}

Figure~\ref{fig:typfig2} provides the formula test for typical cases in Rank 2, which should be taken into consideration only after looking at typical cases in Rank 1, as a second best option. Since for these cases the membership in the sufficient term is given by the complementary conjunct cct, which is fixed at 0.6, cases are all situated in the left part of the upper right quadrant. Formula values drop as cases approach the diagonal, however they don't change in between values of the focal conjunct since these case in Rank 2 are not defined by this.

\begin{knitrout}
\definecolor{shadecolor}{rgb}{0.969, 0.969, 0.969}\color{fgcolor}\begin{figure}[t]
\includegraphics[width=\maxwidth]{figure/typfig2-1} \caption[Typical Cases Test Rank 2]{Typical Cases Test Rank 2}\label{fig:typfig2}
\end{figure}


\end{knitrout}

\subsection{Deviant Consistency Cases}
\label{sec:dcn}

For producing and testing deviant consistency cases in kind, which are members of the sufficient term, but not of the outcome, we create data in which the sufficient term $sdc$ is above 0.5, but the outcome $ydc$ is below 0.5. Figure~\ref{fig:dcnfig} provides a test for all the possible combinations of sufficient term membership values and outcome memership values created. We can see that as membership in the sufficient term increases (cases more towards the right of the plot), formula values decrease. Additionally, as the distance between memership in the term and membership in the outcome becomes larges (cases further from the diagonal), the formula value becomes smaller, with the best possible case being intuitively located in the lower right corner.

\begin{knitrout}
\definecolor{shadecolor}{rgb}{0.969, 0.969, 0.969}\color{fgcolor}\begin{kframe}
\begin{alltt}
\hlcom{# Filter: S > 0.5 & Y < 0.5 (S- sufficient term, Y- outcome)}

\hlstd{sdc} \hlkwb{<-} \hlkwd{round}\hlstd{(}\hlkwd{seq}\hlstd{(}\hlnum{0.6}\hlstd{,} \hlnum{1}\hlstd{,} \hlnum{0.1}\hlstd{),} \hlkwc{digits} \hlstd{=} \hlnum{1}\hlstd{)}  \hlcom{#Sufficient Term}
\hlstd{ydc} \hlkwb{<-} \hlkwd{round}\hlstd{(}\hlkwd{seq}\hlstd{(}\hlnum{0}\hlstd{,} \hlnum{0.4}\hlstd{,} \hlnum{0.1}\hlstd{),} \hlkwc{digits} \hlstd{=} \hlnum{1}\hlstd{)}  \hlcom{#Outcome}
\hlstd{hd} \hlkwb{<-} \hlkwd{expand.grid}\hlstd{(sdc, ydc)}
\hlkwd{colnames}\hlstd{(hd)} \hlkwb{<-} \hlkwd{c}\hlstd{(}\hlstr{"sdc"}\hlstd{,} \hlstr{"ydc"}\hlstd{)}
\hlstd{hd[,} \hlnum{1}\hlopt{:}\hlnum{2}\hlstd{]} \hlkwb{<-} \hlkwd{round}\hlstd{(hd[,} \hlnum{1}\hlopt{:}\hlnum{2}\hlstd{],} \hlkwc{digits} \hlstd{=} \hlnum{1}\hlstd{)}

\hlcom{# Add columns with values in the formulas:}

\hlstd{hd}\hlopt{$}\hlstd{f8a} \hlkwb{<-} \hlkwd{round}\hlstd{(}\hlkwd{with}\hlstd{(hd, ((}\hlnum{1} \hlopt{-} \hlstd{(sdc} \hlopt{-} \hlstd{ydc))} \hlopt{+} \hlstd{(}\hlnum{1} \hlopt{-} \hlstd{sdc))),} \hlkwc{digits} \hlstd{=} \hlnum{2}\hlstd{)}

\hlstd{hd}\hlopt{$}\hlstd{f8laba} \hlkwb{<-} \hlkwd{as.character}\hlstd{(hd}\hlopt{$}\hlstd{f8a)}
\hlstd{hd}\hlopt{$}\hlstd{f8a} \hlkwb{<-} \hlkwd{round}\hlstd{(hd}\hlopt{$}\hlstd{f8a,} \hlkwc{digits} \hlstd{=} \hlnum{2}\hlstd{)}
\end{alltt}
\end{kframe}
\end{knitrout}

\begin{knitrout}
\definecolor{shadecolor}{rgb}{0.969, 0.969, 0.969}\color{fgcolor}\begin{figure}[t]
\includegraphics[width=\maxwidth]{figure/dcnfig-1} \caption[Deviant Consistency Cases]{Deviant Consistency Cases}\label{fig:dcnfig}
\end{figure}


\end{knitrout}

\subsection{Deviant Coverage Cases}
\label{sec:dcv}

Deviant coverage cases are situated in the upper left quadrant of an xy plot for sufficiency and therefore for producing them we create data in which membership in the outcome $ydcv$ is above 0.5 and membership in the solution formula is below 0.5. Additionally, since the goal of analysing these cases is to identify an entire missing conjunction, membership in the truth table row that the case belongs to $ttcv$ also needs to be produced.  Figure~\ref{fig:dcvfig} tests the formula for these cases using all the possible combinations between sufficient solution membership values, outcome memership values, and truth table membership values. Since the membership in the sufficient solution does not enter the calculation of the formula, we can see that values on the same row (equal outcome membership) in the same plot (equal truth table membership) stay the same. However, as truth table row membership increases, and we move from one plot to another, formula values decrease. Additionally, within the same plot, formula values are smaller as the truth table membership is more similar to the outcome membership.

\begin{knitrout}
\definecolor{shadecolor}{rgb}{0.969, 0.969, 0.969}\color{fgcolor}\begin{kframe}
\begin{alltt}
\hlcom{# Filter: (F < 0.5) & (Y > 0.5) (F- sufficient formula, Y- outcome)}


\hlcom{# NB: This test is quite hard to do and visualize, because we are working}
\hlcom{# with both sufficient formula values and TT values}

\hlstd{ydcv} \hlkwb{<-} \hlkwd{round}\hlstd{(}\hlkwd{seq}\hlstd{(}\hlnum{0.6}\hlstd{,} \hlnum{1}\hlstd{,} \hlnum{0.1}\hlstd{),} \hlkwc{digits} \hlstd{=} \hlnum{1}\hlstd{)}  \hlcom{#Outcome}
\hlstd{fdcv} \hlkwb{<-} \hlkwd{round}\hlstd{(}\hlkwd{seq}\hlstd{(}\hlnum{0}\hlstd{,} \hlnum{0.4}\hlstd{,} \hlnum{0.1}\hlstd{),} \hlkwc{digits} \hlstd{=} \hlnum{1}\hlstd{)}  \hlcom{#Sufficient formula}
\hlstd{ttcv} \hlkwb{<-} \hlkwd{round}\hlstd{(}\hlkwd{seq}\hlstd{(}\hlnum{0.6}\hlstd{,} \hlnum{1}\hlstd{,} \hlnum{0.1}\hlstd{),} \hlkwc{digits} \hlstd{=} \hlnum{1}\hlstd{)}  \hlcom{#Truth table membership}
\hlstd{hd} \hlkwb{<-} \hlkwd{expand.grid}\hlstd{(fdcv, ydcv, ttcv)}
\hlkwd{colnames}\hlstd{(hd)} \hlkwb{<-} \hlkwd{c}\hlstd{(}\hlstr{"fdcv"}\hlstd{,} \hlstr{"ydcv"}\hlstd{,} \hlstr{"ttcv"}\hlstd{)}
\hlstd{hd[,} \hlnum{1}\hlopt{:}\hlnum{3}\hlstd{]} \hlkwb{<-} \hlkwd{round}\hlstd{(hd[,} \hlnum{1}\hlopt{:}\hlnum{3}\hlstd{],} \hlkwc{digits} \hlstd{=} \hlnum{1}\hlstd{)}

\hlcom{# Add columns with values in the formulas:}

\hlstd{hd}\hlopt{$}\hlstd{f8a} \hlkwb{<-} \hlkwd{round}\hlstd{(}\hlkwd{with}\hlstd{(hd, (}\hlkwd{abs}\hlstd{(ydcv} \hlopt{-} \hlstd{ttcv))} \hlopt{+} \hlstd{(}\hlnum{1} \hlopt{-} \hlstd{ttcv)),} \hlkwc{digits} \hlstd{=} \hlnum{2}\hlstd{)}
\hlstd{hd}\hlopt{$}\hlstd{f8laba} \hlkwb{<-} \hlkwd{as.character}\hlstd{(hd}\hlopt{$}\hlstd{f8a)}
\hlstd{hd}\hlopt{$}\hlstd{f8a} \hlkwb{<-} \hlkwd{round}\hlstd{(hd}\hlopt{$}\hlstd{f8a,} \hlkwc{digits} \hlstd{=} \hlnum{2}\hlstd{)}
\end{alltt}
\end{kframe}
\end{knitrout}
\begin{knitrout}
\definecolor{shadecolor}{rgb}{0.969, 0.969, 0.969}\color{fgcolor}\begin{figure}[t]
\includegraphics[width=\maxwidth]{figure/dcvfig-1} \caption[Deviant Coverage Cases]{Deviant Coverage Cases}\label{fig:dcvfig}
\end{figure}


\end{knitrout}

\section{Testing Comparative MMR Formulas}
\label{sec:cf}

\subsection{Typical - IIR Cases}
\label{sec:typiir}

For comparing typical and IIR cases we create typical cases as explained above. For testing comparisons in the first 6 Ranks, we create IIR cases that have a focal conjunct $fci$ lower than 0.5, a complementary conjunct $cci$ taking any values between 0 and 1 (in increments of 0.1), and an outcome $yi$ of lower than 0.5. We then create a dataframe hd with all the possible combinations between the typical cases' membership values and IIR cases' values.

\begin{knitrout}
\definecolor{shadecolor}{rgb}{0.969, 0.969, 0.969}\color{fgcolor}\begin{kframe}
\begin{alltt}
\hlstd{fct} \hlkwb{<-} \hlkwd{round}\hlstd{(}\hlkwd{seq}\hlstd{(}\hlnum{0.6}\hlstd{,} \hlnum{1}\hlstd{,} \hlnum{0.1}\hlstd{),} \hlkwc{digits} \hlstd{=} \hlnum{1}\hlstd{)} \hlcom{#Focal Conjunct Typical}
\hlstd{cct} \hlkwb{<-} \hlkwd{round}\hlstd{(}\hlkwd{seq}\hlstd{(}\hlnum{0.6}\hlstd{,} \hlnum{1}\hlstd{,} \hlnum{0.1}\hlstd{),} \hlkwc{digits} \hlstd{=} \hlnum{1}\hlstd{)} \hlcom{#Complementary Conjunct}
                                           \hlcom{#Typical}
\hlstd{yt} \hlkwb{<-}  \hlkwd{round}\hlstd{(}\hlkwd{seq}\hlstd{(}\hlnum{0.6}\hlstd{,} \hlnum{1}\hlstd{,} \hlnum{0.1}\hlstd{),} \hlkwc{digits} \hlstd{=} \hlnum{1}\hlstd{)} \hlcom{#Outcome Typical}
\hlstd{fci} \hlkwb{<-} \hlkwd{round}\hlstd{(}\hlkwd{seq}\hlstd{(}\hlnum{0}\hlstd{,} \hlnum{0.4}\hlstd{,} \hlnum{0.1}\hlstd{),} \hlkwc{digits} \hlstd{=} \hlnum{1}\hlstd{)} \hlcom{#Focal Conjunct}
\hlstd{cci} \hlkwb{<-} \hlkwd{round}\hlstd{(}\hlkwd{seq}\hlstd{(}\hlnum{0}\hlstd{,} \hlnum{1}\hlstd{,} \hlnum{0.1}\hlstd{),} \hlkwc{digits} \hlstd{=} \hlnum{1}\hlstd{)} \hlcom{#Complementary Conjunct IIR}
\hlstd{yi} \hlkwb{<-} \hlkwd{round}\hlstd{(}\hlkwd{seq}\hlstd{(}\hlnum{0}\hlstd{,} \hlnum{0.4}\hlstd{,} \hlnum{0.1}\hlstd{),} \hlkwc{digits} \hlstd{=} \hlnum{1}\hlstd{)} \hlcom{#Outcome IIR}
\hlstd{hd} \hlkwb{<-} \hlkwd{expand.grid}\hlstd{(fct, cct, yt, fci, cci, yi)}
\hlkwd{colnames}\hlstd{(hd)} \hlkwb{<-} \hlkwd{c}\hlstd{(}\hlstr{"fct"}\hlstd{,} \hlstr{"cct"}\hlstd{,} \hlstr{"yt"}\hlstd{,} \hlstr{"fci"}\hlstd{,} \hlstr{"cci"}\hlstd{,} \hlstr{"yi"}\hlstd{)}
\hlstd{hd[,}\hlnum{1}\hlopt{:}\hlnum{6}\hlstd{]} \hlkwb{<-} \hlkwd{round}\hlstd{(hd[,}\hlnum{1}\hlopt{:}\hlnum{6}\hlstd{],} \hlkwc{digits} \hlstd{=} \hlnum{1}\hlstd{)}

\hlcom{# Add columns with values in the formulas:}


\hlstd{hd}\hlopt{$}\hlstd{f8a} \hlkwb{<-} \hlkwd{round}\hlstd{(}\hlkwd{with}\hlstd{(hd, ((}\hlnum{1}\hlopt{-}\hlstd{(fct}\hlopt{-}\hlstd{fci))}\hlopt{+} \hlcom{#big diff. in FC}
                            \hlstd{(}\hlnum{1}\hlopt{-}\hlstd{(yt}\hlopt{-}\hlstd{yi))}\hlopt{+} \hlcom{#big diff in Y}
                            \hlkwd{abs}\hlstd{(cct}\hlopt{-}\hlstd{cci)}\hlopt{+} \hlcom{#small diff in complementary conj.}
                            \hlnum{2}\hlopt{*}\hlkwd{abs}\hlstd{(yt}\hlopt{-}\hlkwd{pmin}\hlstd{(fct,cct))}\hlopt{+}
                            \hlnum{2}\hlopt{*}\hlkwd{abs}\hlstd{(yi}\hlopt{-}\hlkwd{pmin}\hlstd{(fci,cci))))}
                            \hlcom{#small corridor for mechanism}
                \hlstd{,} \hlkwc{digits} \hlstd{=} \hlnum{2}\hlstd{)}

\hlstd{hd}\hlopt{$}\hlstd{f8laba} \hlkwb{<-} \hlkwd{as.character}\hlstd{(hd}\hlopt{$}\hlstd{f8a)}

\hlcom{# RANK 1:FCT<=CCT, CCI>0.5, FCI<=CCI}

\hlcom{# RANK 2: FCT<=CCT, CCI<0.5, , FCI<=CCI}

\hlcom{# RANK 3:FCT<=CCT, FCI < 0.5 & CCI < 0.5 & CCI <= FCI}

\hlcom{# (they are all above the diagonal as CCI is providing the min}
\hlcom{# for this rank and it is set to 0)}

\hlcom{# RANK 4: FCT>CCT, CCI>0.5 , FCI <= CCI}

\hlcom{# RANK 5: FCT>CCT, CCI<0.5, , FCI <= CCI}

\hlcom{# NB. For cases in this rank, while CCI is held constant,}
\hlcom{# CCT is moving (compared to FCT as for the other).}
\hlcom{# Since CCT is moving and CCI is constant,}
\hlcom{# and YT is moving and YI is constant,}
\hlcom{# these two distances cancel each other out.}

\hlcom{# For exemplification look at the subseted dataframes that}
\hlcom{# show how the two principle cancel}
\hlcom{# each other out and the graph is not able to capture this:}

\hlcom{# subtest1 <- subset(hd, (fci == c(0.3)) & (yi == c(0.4)) &}
                    \hlcom{# (fct == 1) & (cci == 0.4) & (cct <= yt))}
\hlcom{# View(subtest1)}

\hlcom{# RANK 6: FCT>CCT, FCI < 0.5 & CCI < 0.5 & CCI <= FCI}

\hlcom{# (all above the diagonal as CCI is the min and set to 0)}

\hlcom{# NB. For cases in this rank, CCI is held constant while CCT moving}
\hlcom{# (compared to FCT as for the other ranks).}
\hlcom{# Since CCT is moving and CCI is constant,}
\hlcom{# and YT is moving and YI is constant,}
\hlcom{# these two distances cancel each other out.}

\hlcom{# For exemplification look at the subseted dataframes that show how}
\hlcom{# the two principle cancel each other out and the graph is}
\hlcom{# not able to capture this:}

\hlcom{# subtest2 <- subset(hd, (fci == c(0.3)) & (yi == c(0.4)) &}
\hlcom{#                    (fct == 1) & (cci == 0) & (cct <= yt))}
\hlcom{# View(subtest2)}
\end{alltt}
\end{kframe}
\end{knitrout}

For testing Rank 1 we subset only those typical cases in which the focal conjunct is smaller or equal to the complementary conjunct (therefore providing the membership in the sufficient term), and those IIR cases in which the complementary conjunct is above 0.5 and, subsequently, larger than the focal conjunct. For setting up the test in Figures~\ref{fig:typiira11},~\ref{fig:typiira12},~\ref{fig:typiirb11}, and ~\ref{fig:typiirb12} we keep membership in the complementary conjunct of the typical and IIR case constant (set at 1), while varying memership of the typical case's focal conjunct and typical case's outcome \textit{within} the same plot, and memership of the IIR case's focal conjunct and IIR case's outcome \textit{between} the plots. Within each plot in the two figures (keeping the IIR case constant) the formula values get smaller as the typical case approaches the diagonal (small corridor for mechanism), as the membership in the typical case focal conjunct increases (making the difference in the focal conjuncts bigger) and as the membership in outcome increases (bigger difference in outcome values). Between the plots, the formula values increase the furthest the IIR case gets from the diagonal (making the corridor for the mechanism larger), the larger its membership in the focal conjunct is (making it close to the focal conjunct value of the typical case) and the larger its membership in the outcome is (making it close to the outcome value of the typical case). Additionally, formula values are symetrical for IIR cases above and below the diagonal and the best possible case comparison (formula value is 0) is between the extreme lower left corner and the extreme upper right corner.

\begin{knitrout}
\definecolor{shadecolor}{rgb}{0.969, 0.969, 0.969}\color{fgcolor}\begin{figure}[t]
\includegraphics[width=\maxwidth]{figure/typiira1-1} \caption[Typical-IIR Rank 1 with IIR above diagonal]{Typical-IIR Rank 1 with IIR above diagonal}\label{fig:typiira11}
\end{figure}

\begin{figure}[t]
\includegraphics[width=\maxwidth]{figure/typiira1-2} \caption[Typical-IIR Rank 1 with IIR above diagonal]{Typical-IIR Rank 1 with IIR above diagonal}\label{fig:typiira12}
\end{figure}


\end{knitrout}

\begin{knitrout}
\definecolor{shadecolor}{rgb}{0.969, 0.969, 0.969}\color{fgcolor}\begin{figure}[t]
\includegraphics[width=\maxwidth]{figure/typiirb1-1} \caption[Typical-IIR Rank 1 with IIR below diagonal]{Typical-IIR Rank 1 with IIR below diagonal}\label{fig:typiirb11}
\end{figure}

\begin{figure}[t]
\includegraphics[width=\maxwidth]{figure/typiirb1-2} \caption[Typical-IIR Rank 1 with IIR below diagonal]{Typical-IIR Rank 1 with IIR below diagonal}\label{fig:typiirb12}
\end{figure}


\end{knitrout}

For testing Rank 2 we subset typical cases in which the focal conjunct is smaller or equal to the complementary conjunct, and IIR cases in which the complementary conjunct is below 0.5, but still larger than the focal conjunct. For setting up the test in Figures~\ref{fig:typiira21}, ~\ref{fig:typiira22}, ~\ref{fig:typiirb21} and ~\ref{fig:typiirb22} we keep membership in the complementary conjunct of the typical and IIR case constant (set at 1 and 0.4, respectively), while varying memership of the typical case's focal conjunct and typical case's outcome \textit{within} the same plot, and memership of the IIR case's focal conjunct and IIR case's outcome \textit{between} the plots. Test results are the same as for Rank 1, within each plot (keeping the IIR case constant) formula values getting smaller as the typical case approaches the diagonal and as the membership in the typical case focal conjunct and outcome increase. Again, between the plots, the formula values increase the furthest the IIR case gets from the diagonal and the larger its membership in the focal conjunct and outcome is.

\begin{knitrout}
\definecolor{shadecolor}{rgb}{0.969, 0.969, 0.969}\color{fgcolor}\begin{figure}[t]
\includegraphics[width=\maxwidth]{figure/typiira2-1} \caption[Typical-IIR Rank 2 with IIR above diagonal]{Typical-IIR Rank 2 with IIR above diagonal}\label{fig:typiira21}
\end{figure}

\begin{figure}[t]
\includegraphics[width=\maxwidth]{figure/typiira2-2} \caption[Typical-IIR Rank 2 with IIR above diagonal]{Typical-IIR Rank 2 with IIR above diagonal}\label{fig:typiira22}
\end{figure}


\end{knitrout}

\begin{knitrout}
\definecolor{shadecolor}{rgb}{0.969, 0.969, 0.969}\color{fgcolor}\begin{figure}[t]
\includegraphics[width=\maxwidth]{figure/typiirb2-1} \caption[Typical-IIR Rank 2 with IIR below diagonal]{Typical-IIR Rank 2 with IIR below diagonal}\label{fig:typiirb21}
\end{figure}

\begin{figure}[t]
\includegraphics[width=\maxwidth]{figure/typiirb2-2} \caption[Typical-IIR Rank 2 with IIR below diagonal]{Typical-IIR Rank 2 with IIR below diagonal}\label{fig:typiirb22}
\end{figure}


\end{knitrout}

Pairs in Rank 3 consist of typical cases in which the focal conjunct is smaller or equal to the complementary conjunct, and IIR cases in which the complementary conjunct is below 0.5 and smaller than the focal conjunct. Therefore, xy plots will not be able to refect changes in the focal conjunct value for the IIR case, as the sufficient term membership is given by the complementary conjunct. Figures~\ref{fig:typiir31} and ~\ref{fig:typiir32} present the test in which typical complementary conjunct is set to 1 and IIR complementary conjunct is set to 0.\textit{Within} the same plot (keeping the IIR case constant) formula values are smaller as the typical case approaches the diagonal, as the membership in the typical case focal conjunct increases and as the membership in outcome increases. \textit{Between} plots the formula values increase the furthest the IIR case gets from the diagonal. Additionally, the formula values also increase as the membership values of the IIR case in the focal conjunct increases, which can be noticed between plots where the IIR case is located in the same spot, but the fci value is different.

\begin{knitrout}
\definecolor{shadecolor}{rgb}{0.969, 0.969, 0.969}\color{fgcolor}\begin{figure}[t]
\includegraphics[width=\maxwidth]{figure/typiir3-1} \caption[Typical-IIR Rank 3]{Typical-IIR Rank 3}\label{fig:typiir31}
\end{figure}

\begin{figure}[t]
\includegraphics[width=\maxwidth]{figure/typiir3-2} \caption[Typical-IIR Rank 3]{Typical-IIR Rank 3}\label{fig:typiir32}
\end{figure}


\end{knitrout}

For pairs in Rank 4 typical cases have focal conjuncts larger than their complementary conjuncts, while IIR cases have complementary conjunct above 0.5 and, subsequently, larger than their focal conjuncts. Since the sufficient term membership of the typical cases is given by the complementary conjuncts, xy plots between the sufficient term and the outcome will not be able to refect changes in the focal conjunct value for these cases. Fot the test in  Figures~\ref{fig:typiira41}, ~\ref{fig:typiira42}, ~\ref{fig:typiirb41}, and ~\ref{fig:typiirb42}  the typical focal conjunct is set to 1 and the IIR complementary conjunct is set to 1.\textit{Within} the same plot (keeping the IIR case constant) formula values are smaller as the typical case approaches the diagonal (respecting the principle of small corridor for the mechanism), as the membership in outcome increases (bigger difference in outcome values) and as the membership in the complementary conjunct approaches 1, the value of the IIR complementary conjunct. \textit{Between} plots the formula values increase the furthest the IIR case gets from the diagonal and as the membership values of the IIR case in the focal conjunct increases.

\begin{knitrout}
\definecolor{shadecolor}{rgb}{0.969, 0.969, 0.969}\color{fgcolor}\begin{figure}[t]
\includegraphics[width=\maxwidth]{figure/typiira4-1} \caption[Typical-IIR Rank 4 with IIR above diagonal]{Typical-IIR Rank 4 with IIR above diagonal}\label{fig:typiira41}
\end{figure}

\begin{figure}[t]
\includegraphics[width=\maxwidth]{figure/typiira4-2} \caption[Typical-IIR Rank 4 with IIR above diagonal]{Typical-IIR Rank 4 with IIR above diagonal}\label{fig:typiira42}
\end{figure}


\end{knitrout}

\begin{knitrout}
\definecolor{shadecolor}{rgb}{0.969, 0.969, 0.969}\color{fgcolor}\begin{figure}[t]
\includegraphics[width=\maxwidth]{figure/typiirb4-1} \caption[Typical-IIR Rank 4 with IIR below diagonal]{Typical-IIR Rank 4 with IIR below diagonal}\label{fig:typiirb41}
\end{figure}

\begin{figure}[t]
\includegraphics[width=\maxwidth]{figure/typiirb4-2} \caption[Typical-IIR Rank 4 with IIR below diagonal]{Typical-IIR Rank 4 with IIR below diagonal}\label{fig:typiirb42}
\end{figure}


\end{knitrout}

Rank 5 consists of typical cases that have focal conjuncts larger than their complementary conjuncts and IIR cases that have complementary conjuncts below 0.5, but still larger than their focal conjuncts. The test for these cases is set just like the test for cases in Rank 4, with the sole difference that now the IIR case membership in the complementary conjunct is set to 0.4. The results in Figures~\ref{fig:typiira51}, ~\ref{fig:typiira52}, ~\ref{fig:typiirb51}, and ~\ref{fig:typiirb52} show that \textit{within} the same plot (keeping the IIR case constant) formula values are smaller as the typical case approaches the diagonal (respecting the principle of small corridor for the mechanism). However, cases with the same distance to the diagonal have the same value, as two principles cancel out each other. Formula values increase as the membership in outcome increases (bigger difference in outcome values), but decrease as the membership in the complementary conjunct are lower and approach 0.4, the value of the IIR complementary conjunct.

\begin{knitrout}
\definecolor{shadecolor}{rgb}{0.969, 0.969, 0.969}\color{fgcolor}\begin{figure}[t]
\includegraphics[width=\maxwidth]{figure/typiira5-1} \caption[Typical-IIR Rank 5 with IIR above diagonal]{Typical-IIR Rank 5 with IIR above diagonal}\label{fig:typiira51}
\end{figure}

\begin{figure}[t]
\includegraphics[width=\maxwidth]{figure/typiira5-2} \caption[Typical-IIR Rank 5 with IIR above diagonal]{Typical-IIR Rank 5 with IIR above diagonal}\label{fig:typiira52}
\end{figure}


\end{knitrout}

\begin{knitrout}
\definecolor{shadecolor}{rgb}{0.969, 0.969, 0.969}\color{fgcolor}\begin{figure}[t]
\includegraphics[width=\maxwidth]{figure/typiirb5-1} \caption[Typical-IIR Rank 5 with IIR below diagonal]{Typical-IIR Rank 5 with IIR below diagonal}\label{fig:typiirb51}
\end{figure}

\begin{figure}[t]
\includegraphics[width=\maxwidth]{figure/typiirb5-2} \caption[Typical-IIR Rank 5 with IIR below diagonal]{Typical-IIR Rank 5 with IIR below diagonal}\label{fig:typiirb52}
\end{figure}


\end{knitrout}

Pairs in Rank 6 have typical cases with focal conjuncts larger than their complementary conjuncts and IIR cases with complementary conjuncts smaller than their focal conjuncts, which are below 0.5. The test in  Figures~\ref{fig:typiir61}, ~\ref{fig:typiir62}, and ~\ref{fig:typiir63} has the typical focal conjunct set to 1 and the IIR complementary conjunct set to 0, which keeps all the IIR cases chosen for the test above the diagonal and on the same vertical line. As for Rank 5, results show that formula values decrease within plots, as typical cases approach the diagonal, but stay the same for those with the same distance to it as two principles cancel out (big difference in outcome, but small difference in complementary conjunct). Formula values increase as IIR cases get further from the diagonal, as they have a larger membership in the outcome, and as their membership in the focal conjunct increases (which is not reflected in the location of the dot identifying the case).

\begin{knitrout}
\definecolor{shadecolor}{rgb}{0.969, 0.969, 0.969}\color{fgcolor}\begin{figure}[t]
\includegraphics[width=\maxwidth]{figure/typiir6-1} \caption[Typical-IIR Rank 6]{Typical-IIR Rank 6}\label{fig:typiir61}
\end{figure}

\begin{figure}[t]
\includegraphics[width=\maxwidth]{figure/typiir6-2} \caption[Typical-IIR Rank 6]{Typical-IIR Rank 6}\label{fig:typiir62}
\end{figure}

\begin{figure}[t]
\includegraphics[width=\maxwidth]{figure/typiir6-3} \caption[Typical-IIR Rank 6]{Typical-IIR Rank 6}\label{fig:typiir63}
\end{figure}


\end{knitrout}

Lastly, pairs in Ranks 7 and 8 have IIR cases with focal conjuncts larger than 0.5 and complementary conjuncts smaller than 0.5, which for the purpose of these test we will set to 0. Typical cases in Rank 7 have focal conjuncts smaller than their complementary conjuncts, which for testing we set to 1. In Figures~\ref{fig:typiir71}, ~\ref{fig:typiir72}, and ~\ref{fig:typiir73}, formula values decrease within plots, as typical cases approach the diagonal, as they have a larger membership in the outcome, and as they have a larger membership in the focal conjunct. Formula values increase between plots as IIR cases get further from the diagonal, as their membership in the outcome increases, and as their membership in the focal conjunct increases (which is not noticeable in the location of the dots). Alternatively, typical cases in Rank 8 have focal conjuncts larger than their complementary conjuncts, and therefore we set fct to 1.  In Figures~\ref{fig:typiir81}, ~\ref{fig:typiir82}, and ~\ref{fig:typiir83} formula values decrease within plots as typical cases approach the diagonal, but stay the same at the same distance due to principles cancelling out (big differece in the outcome, small difference in the complementary conjuncts). Formula values increase between plots in the same manner as for Rank 7.

\begin{knitrout}
\definecolor{shadecolor}{rgb}{0.969, 0.969, 0.969}\color{fgcolor}\begin{kframe}
\begin{alltt}
\hlcom{# For the last two ranks we need to create data}
\hlcom{# that has CCI <0.5 and FCI > 0.5:}

\hlstd{fct} \hlkwb{<-} \hlkwd{round}\hlstd{(}\hlkwd{seq}\hlstd{(}\hlnum{0.6}\hlstd{,} \hlnum{1}\hlstd{,} \hlnum{0.1}\hlstd{),} \hlkwc{digits} \hlstd{=} \hlnum{1}\hlstd{)}
\hlstd{cct} \hlkwb{<-} \hlkwd{round}\hlstd{(}\hlkwd{seq}\hlstd{(}\hlnum{0.6}\hlstd{,} \hlnum{1}\hlstd{,} \hlnum{0.1}\hlstd{),} \hlkwc{digits} \hlstd{=} \hlnum{1}\hlstd{)}
\hlstd{yt} \hlkwb{<-}  \hlkwd{round}\hlstd{(}\hlkwd{seq}\hlstd{(}\hlnum{0.6}\hlstd{,} \hlnum{1}\hlstd{,} \hlnum{0.1}\hlstd{),} \hlkwc{digits} \hlstd{=} \hlnum{1}\hlstd{)}
\hlstd{fci} \hlkwb{<-} \hlkwd{round}\hlstd{(}\hlkwd{seq}\hlstd{(}\hlnum{0.6}\hlstd{,} \hlnum{1}\hlstd{,} \hlnum{0.1}\hlstd{),} \hlkwc{digits} \hlstd{=} \hlnum{1}\hlstd{)}
\hlstd{cci} \hlkwb{<-} \hlkwd{round}\hlstd{(}\hlkwd{seq}\hlstd{(}\hlnum{0}\hlstd{,} \hlnum{0.4}\hlstd{,} \hlnum{0.1}\hlstd{),} \hlkwc{digits} \hlstd{=} \hlnum{1}\hlstd{)}
\hlstd{yi} \hlkwb{<-} \hlkwd{round}\hlstd{(}\hlkwd{seq}\hlstd{(}\hlnum{0}\hlstd{,} \hlnum{0.4}\hlstd{,} \hlnum{0.1}\hlstd{),} \hlkwc{digits} \hlstd{=} \hlnum{1}\hlstd{)}
\hlstd{hd2} \hlkwb{<-} \hlkwd{expand.grid}\hlstd{(fct, cct, yt, fci, cci, yi)}
\hlkwd{colnames}\hlstd{(hd2)} \hlkwb{<-} \hlkwd{c}\hlstd{(}\hlstr{"fct"}\hlstd{,} \hlstr{"cct"}\hlstd{,} \hlstr{"yt"}\hlstd{,} \hlstr{"fci"}\hlstd{,} \hlstr{"cci"}\hlstd{,} \hlstr{"yi"}\hlstd{)}
\hlstd{hd2[,}\hlnum{1}\hlopt{:}\hlnum{6}\hlstd{]} \hlkwb{<-} \hlkwd{round}\hlstd{(hd2[,}\hlnum{1}\hlopt{:}\hlnum{6}\hlstd{],} \hlkwc{digits} \hlstd{=} \hlnum{1}\hlstd{)}

\hlcom{# Add columns with values in the formulas:}

\hlstd{hd2}\hlopt{$}\hlstd{f8a} \hlkwb{<-} \hlkwd{round}\hlstd{(}\hlkwd{with}\hlstd{(hd2, ((}\hlnum{1}\hlopt{-}\hlstd{(fct}\hlopt{-}\hlstd{fci))}\hlopt{+} \hlcom{#big diff. in FC}
                              \hlstd{(}\hlnum{1}\hlopt{-}\hlstd{(yt}\hlopt{-}\hlstd{yi))}\hlopt{+} \hlcom{#big diff in Y}
                              \hlkwd{abs}\hlstd{(cct}\hlopt{-}\hlstd{cci)}\hlopt{+} \hlcom{#small diff in complementary conj.}
                              \hlnum{2}\hlopt{*}\hlkwd{abs}\hlstd{(yt}\hlopt{-}\hlkwd{pmin}\hlstd{(fct,cct))}\hlopt{+}
                              \hlnum{2}\hlopt{*}\hlkwd{abs}\hlstd{(yi}\hlopt{-}\hlkwd{pmin}\hlstd{(fci,cci))))}
                              \hlcom{#small corridor for mechanism}
                 \hlstd{,} \hlkwc{digits} \hlstd{=} \hlnum{2}\hlstd{)}

\hlstd{hd2}\hlopt{$}\hlstd{f8laba} \hlkwb{<-} \hlkwd{as.character}\hlstd{(hd2}\hlopt{$}\hlstd{f8a)}

\hlcom{# Rank 7 (FCT<=CCT, CCI <0.5, FCI > 0.5):}

\hlcom{# Rank 8 (FCT>CCT, CCI <0.5, FCI > 0.5):}

\hlcom{# NB. For cases in this rank, while CCI is}
\hlcom{# held constant while CCT moving}
\hlcom{# (compared to FCT as for the other ranks).}
\hlcom{# Since CCT is moving and CCI is constant, and}
\hlcom{# YT is moving and YI is constant,}
\hlcom{# these two distances cancel each other out.}
\end{alltt}
\end{kframe}
\end{knitrout}

\begin{knitrout}
\definecolor{shadecolor}{rgb}{0.969, 0.969, 0.969}\color{fgcolor}\begin{figure}[t]
\includegraphics[width=\maxwidth]{figure/typiir7-1} \caption[Typical-IIR Rank 7]{Typical-IIR Rank 7}\label{fig:typiir71}
\end{figure}

\begin{figure}[t]
\includegraphics[width=\maxwidth]{figure/typiir7-2} \caption[Typical-IIR Rank 7]{Typical-IIR Rank 7}\label{fig:typiir72}
\end{figure}

\begin{figure}[t]
\includegraphics[width=\maxwidth]{figure/typiir7-3} \caption[Typical-IIR Rank 7]{Typical-IIR Rank 7}\label{fig:typiir73}
\end{figure}


\end{knitrout}
\begin{knitrout}
\definecolor{shadecolor}{rgb}{0.969, 0.969, 0.969}\color{fgcolor}\begin{figure}[t]
\includegraphics[width=\maxwidth]{figure/typiir8-1} \caption[Typical-IIR Rank 8]{Typical-IIR Rank 8}\label{fig:typiir81}
\end{figure}

\begin{figure}[t]
\includegraphics[width=\maxwidth]{figure/typiir8-2} \caption[Typical-IIR Rank 8]{Typical-IIR Rank 8}\label{fig:typiir82}
\end{figure}

\begin{figure}[t]
\includegraphics[width=\maxwidth]{figure/typiir8-3} \caption[Typical-IIR Rank 8]{Typical-IIR Rank 8}\label{fig:typiir83}
\end{figure}


\end{knitrout}
\subsection{Typical - Typical Cases}
\label{sec:typtyp}

For testing pairs of typical and typical cases we create data for two typical cases in which the focal conjunct $fct$, the complementary conjunct $cct$, and an outcome $yt$ are all above 0.5. Two filters are initially applied to the dataframe so created: firstly, only cases above the diagonal are selected ($st \leq yt$), and secondly, the first case needs to be more typical than the second case. After the dataset is subsetted, the remaining typical cases are divided into two types as before (Rank1: $fct \leq cct$; Rank 2: $fct>cct$) which create four possible combinations or pair ranks.

\begin{knitrout}
\definecolor{shadecolor}{rgb}{0.969, 0.969, 0.969}\color{fgcolor}\begin{kframe}
\begin{alltt}
\hlstd{fct1} \hlkwb{<-} \hlkwd{round}\hlstd{(}\hlkwd{seq}\hlstd{(}\hlnum{0.6}\hlstd{,} \hlnum{1}\hlstd{,} \hlnum{0.1}\hlstd{),} \hlkwc{digits} \hlstd{=} \hlnum{1}\hlstd{)} \hlcom{# Focal Conjunct Case 1}
\hlstd{cct1} \hlkwb{<-} \hlkwd{round}\hlstd{(}\hlkwd{seq}\hlstd{(}\hlnum{0.6}\hlstd{,} \hlnum{1}\hlstd{,} \hlnum{0.1}\hlstd{),} \hlkwc{digits} \hlstd{=} \hlnum{1}\hlstd{)} \hlcom{# Complementary Conj. Case1}
\hlstd{yt1} \hlkwb{<-}  \hlkwd{round}\hlstd{(}\hlkwd{seq}\hlstd{(}\hlnum{0.6}\hlstd{,} \hlnum{1}\hlstd{,} \hlnum{0.1}\hlstd{),} \hlkwc{digits} \hlstd{=} \hlnum{1}\hlstd{)} \hlcom{# Outcome Case 1}
\hlstd{fct2} \hlkwb{<-} \hlkwd{round}\hlstd{(}\hlkwd{seq}\hlstd{(}\hlnum{0.6}\hlstd{,} \hlnum{1}\hlstd{,} \hlnum{0.1}\hlstd{),} \hlkwc{digits} \hlstd{=} \hlnum{1}\hlstd{)} \hlcom{# Focal Conjunct Case 2}
\hlstd{cct2} \hlkwb{<-} \hlkwd{round}\hlstd{(}\hlkwd{seq}\hlstd{(}\hlnum{0.6}\hlstd{,} \hlnum{1}\hlstd{,} \hlnum{0.1}\hlstd{),} \hlkwc{digits} \hlstd{=} \hlnum{1}\hlstd{)} \hlcom{# Complementary Conj. Case2}
\hlstd{yt2} \hlkwb{<-} \hlkwd{round}\hlstd{(}\hlkwd{seq}\hlstd{(}\hlnum{0.6}\hlstd{,} \hlnum{1}\hlstd{,} \hlnum{0.1}\hlstd{),} \hlkwc{digits} \hlstd{=} \hlnum{1}\hlstd{)}  \hlcom{# Outcome Case 2}
\hlstd{hd} \hlkwb{<-} \hlkwd{expand.grid}\hlstd{(fct1, cct1, yt1, fct2, cct2, yt2)}
\hlkwd{colnames}\hlstd{(hd)} \hlkwb{<-} \hlkwd{c}\hlstd{(}\hlstr{"fct1"}\hlstd{,} \hlstr{"cct1"}\hlstd{,} \hlstr{"yt1"}\hlstd{,} \hlstr{"fct2"}\hlstd{,} \hlstr{"cct2"}\hlstd{,} \hlstr{"yt2"}\hlstd{)}
\hlstd{hd[,}\hlnum{1}\hlopt{:}\hlnum{6}\hlstd{]} \hlkwb{<-} \hlkwd{round}\hlstd{(hd[,}\hlnum{1}\hlopt{:}\hlnum{6}\hlstd{],} \hlkwc{digits} \hlstd{=} \hlnum{1}\hlstd{)}


\hlcom{# Filtering:}

\hlcom{# Cases should be above the diagonal:}
\hlcom{# (Styp1 <= Ytyp1) & (Styp2 <= Ytyp2)}

\hlcom{# Case 1 should be more typical than Case 2:}
\hlcom{# ((abs(yt1-pmin(fct1,cct1)) + (1-pmin(fct1,cct1))) <=}
\hlcom{# (abs(yt2-pmin(fct2,cct2)) + (1-pmin(fct2,cct2))))}

\hlstd{hd} \hlkwb{<-} \hlkwd{subset}\hlstd{(hd, (}\hlkwd{pmin}\hlstd{(fct1,cct1)} \hlopt{<=} \hlstd{yt1)} \hlopt{&} \hlstd{(}\hlkwd{pmin}\hlstd{(fct2,cct2)} \hlopt{<=} \hlstd{yt2)} \hlopt{&}
                \hlstd{((}\hlkwd{abs}\hlstd{(yt1}\hlopt{-}\hlkwd{pmin}\hlstd{(fct1,cct1))} \hlopt{+} \hlstd{(}\hlnum{1}\hlopt{-}\hlkwd{pmin}\hlstd{(fct1,cct1)))} \hlopt{<=}
                \hlstd{(}\hlkwd{abs}\hlstd{(yt2}\hlopt{-}\hlkwd{pmin}\hlstd{(fct2,cct2))} \hlopt{+} \hlstd{(}\hlnum{1}\hlopt{-}\hlkwd{pmin}\hlstd{(fct2,cct2)))))}


\hlcom{# Add columns with values in the formula:}

\hlstd{hd}\hlopt{$}\hlstd{f8a} \hlkwb{<-} \hlkwd{round}\hlstd{(}\hlkwd{with}\hlstd{(hd, ((}\hlnum{0.5}\hlopt{-}\hlstd{(fct1}\hlopt{-}\hlstd{fct2))}\hlopt{+} \hlcom{#big diff. in FC}
                            \hlstd{(}\hlnum{0.5}\hlopt{-}\hlstd{(yt1}\hlopt{-}\hlstd{yt2))}\hlopt{+} \hlcom{#big diff in Y}
                            \hlkwd{abs}\hlstd{(cct1}\hlopt{-}\hlstd{cct2)}\hlopt{+} \hlcom{#small diff in complementary conj.}
                            \hlnum{2}\hlopt{*}\hlkwd{abs}\hlstd{(yt1}\hlopt{-}\hlkwd{pmin}\hlstd{(fct1,cct1))}\hlopt{+}
                            \hlnum{2}\hlopt{*}\hlkwd{abs}\hlstd{(yt2}\hlopt{-}\hlkwd{pmin}\hlstd{(fct2,cct2))))}
                            \hlcom{#small corridor for mechanism}
                \hlstd{,} \hlkwc{digits} \hlstd{=} \hlnum{2}\hlstd{)}
\hlstd{hd}\hlopt{$}\hlstd{f8a}\hlkwb{<-} \hlkwd{round}\hlstd{(hd}\hlopt{$}\hlstd{f8a,} \hlkwc{digits} \hlstd{=} \hlnum{2}\hlstd{)}
\hlstd{hd}\hlopt{$}\hlstd{f8laba} \hlkwb{<-} \hlkwd{as.character}\hlstd{(hd}\hlopt{$}\hlstd{f8a)}

\hlcom{# (RANK 1:FCT1<=CCT1,FCT2<=CCT2):}

\hlcom{# (RANK 2:FCT1<=CCT1,FCT2>CCT2):}

\hlcom{# (RANK 3:FCT1>CCT1,FCT2<=CCT2):}

\hlcom{# (RANK 4:FCT1>CCT1,FCT2>CCT2):}
\end{alltt}
\end{kframe}
\end{knitrout}

In Pair Rank 1, both typical cases have their focal conjunct smaller or equal to the complementary conjunct. As it can be seen in Figures~\ref{fig:typtyp11} and ~\ref{fig:typtyp12}, only cases more typical than the dotted typical case are selected for pairing. Within the same plot formula values are smaller the higher the membership of the more typical case is in the focal conjunct and the outcome, and the closer to the diagonal that case it. Between plots, formula values get smaller the closer to the diagonal the dotted plot is and the smallest its membership is in the focal conjunct and the outcome.

\begin{knitrout}
\definecolor{shadecolor}{rgb}{0.969, 0.969, 0.969}\color{fgcolor}\begin{figure}[t]
\includegraphics[width=\maxwidth]{figure/typtyp1-1} \caption[Typical-Typical Rank 1]{Typical-Typical Rank 1}\label{fig:typtyp11}
\end{figure}

\begin{figure}[t]
\includegraphics[width=\maxwidth]{figure/typtyp1-2} \caption[Typical-Typical Rank 1]{Typical-Typical Rank 1}\label{fig:typtyp12}
\end{figure}


\end{knitrout}

In Pair Rank 2, one typical cases has the focal conjunct smaller or equal to the complementary conjunct, while the other one does not. Within the same plot in Figure~\ref{fig:typtyp21} and Figure~\ref{fig:typtyp21}, results are the same as for Pair Rank 1 with formula values decreasing the higher the membership of the more typical case is in the focal conjunct and the outcome, and the closer to the diagonal that case it. Between plots, formula values get smaller the closer to the diagonal the dotted plot is, the smallest its membership is in the the outcome, and the smallest the focal conjunct is. However, the last difference cannot be seen in the position of the dotted case in the xy plot, as it is the complementary conjunct providing the membership in the sufficient term in this case (cct2<fct2).

\begin{knitrout}
\definecolor{shadecolor}{rgb}{0.969, 0.969, 0.969}\color{fgcolor}\begin{figure}[t]
\includegraphics[width=\maxwidth]{figure/typtyp2-1} \caption[Typical-Typical Rank 2]{Typical-Typical Rank 2}\label{fig:typtyp21}
\end{figure}

\begin{figure}[t]
\includegraphics[width=\maxwidth]{figure/typtyp2-2} \caption[Typical-Typical Rank 2]{Typical-Typical Rank 2}\label{fig:typtyp22}
\end{figure}


\end{knitrout}

Plots of the cases in Pair Rank 3 (Figures~\ref{fig:typtyp31}, ~\ref{fig:typtyp32}, and ~\ref{fig:typtyp33}) are less intuitive to interpret as it is the more typical cases that has the focal conjunct higher than the complementary conjunct. For setting up this test, the dotted case is the more typical one with smaller distance between the  sufficient term and y and larger membership in the focal conjunct. Within the same plot, the formula gets smaller the further away from the diagonal the second typical case gets and the bigger the difference in the focal conjunct value gets. Between plots, formula values get smaller the closer to the diagonal the dotted plot is and the bigger the difference in the focal conjunct value gets. Cases in Pair Rank 4 function in a similar manner, with the exception that Typical Case 2's membership in the sufficient term is deffined by the complementary conjunct and therefore differences between focal conjuncts cannot be spotted in the same plot.


\begin{knitrout}
\definecolor{shadecolor}{rgb}{0.969, 0.969, 0.969}\color{fgcolor}\begin{figure}[t]
\includegraphics[width=\maxwidth]{figure/typtyp3-1} \caption[Typical-Typical Rank 3]{Typical-Typical Rank 3}\label{fig:typtyp31}
\end{figure}

\begin{figure}[t]
\includegraphics[width=\maxwidth]{figure/typtyp3-2} \caption[Typical-Typical Rank 3]{Typical-Typical Rank 3}\label{fig:typtyp32}
\end{figure}

\begin{figure}[t]
\includegraphics[width=\maxwidth]{figure/typtyp3-3} \caption[Typical-Typical Rank 3]{Typical-Typical Rank 3}\label{fig:typtyp33}
\end{figure}


\end{knitrout}

\begin{knitrout}
\definecolor{shadecolor}{rgb}{0.969, 0.969, 0.969}\color{fgcolor}\begin{figure}[t]
\includegraphics[width=\maxwidth]{figure/typtyp4-1} \caption[Typical-Typical Rank 4]{Typical-Typical Rank 4}\label{fig:typtyp41}
\end{figure}

\begin{figure}[t]
\includegraphics[width=\maxwidth]{figure/typtyp4-2} \caption[Typical-Typical Rank 4]{Typical-Typical Rank 4}\label{fig:typtyp42}
\end{figure}

\begin{figure}[t]
\includegraphics[width=\maxwidth]{figure/typtyp4-3} \caption[Typical-Typical Rank 4]{Typical-Typical Rank 4}\label{fig:typtyp43}
\end{figure}


\end{knitrout}

\subsection{Typical - Deviant Consistency Cases}
\label{sec:typdcn}

Figures~\ref{fig:typdcn1} and ~\ref{fig:typdcn2} show the test for pairing typical case and deviant consistency cases in kind. Within the same plot we see that the bigger the difference in outcome values between the typical case and the deviant case, the smaller the formula values is. However, deviant consistency cases on the same horizontal line have the same formula values. This is because two of the principles implemented cancel each other out when keeping the typical case static: the larger the membership of the deviant consistency case in the sufficient term, the larger also the difference to the term membership of the static typical case. Nevertheless, looking between plots, we can see that formula values drop as the typical case term membership is larger and as the difference to the deviant case term membership is smaller.

\begin{knitrout}
\definecolor{shadecolor}{rgb}{0.969, 0.969, 0.969}\color{fgcolor}\begin{kframe}
\begin{alltt}
\hlstd{st} \hlkwb{<-} \hlkwd{round}\hlstd{(}\hlkwd{seq}\hlstd{(}\hlnum{0.6}\hlstd{,} \hlnum{1}\hlstd{,} \hlnum{0.1}\hlstd{),} \hlkwc{digits} \hlstd{=} \hlnum{1}\hlstd{)} \hlcom{#Sufficient Term Typical}
\hlstd{yt} \hlkwb{<-}  \hlkwd{round}\hlstd{(}\hlkwd{seq}\hlstd{(}\hlnum{0.6}\hlstd{,} \hlnum{1}\hlstd{,} \hlnum{0.1}\hlstd{),} \hlkwc{digits} \hlstd{=} \hlnum{1}\hlstd{)} \hlcom{#Outcome Typical}
\hlstd{sc} \hlkwb{<-} \hlkwd{round}\hlstd{(}\hlkwd{seq}\hlstd{(}\hlnum{0.6}\hlstd{,} \hlnum{1}\hlstd{,} \hlnum{0.1}\hlstd{),} \hlkwc{digits} \hlstd{=} \hlnum{1}\hlstd{)} \hlcom{#Sufficient Term DCN}
\hlstd{yc} \hlkwb{<-} \hlkwd{round}\hlstd{(}\hlkwd{seq}\hlstd{(}\hlnum{0}\hlstd{,} \hlnum{0.4}\hlstd{,} \hlnum{0.1}\hlstd{),} \hlkwc{digits} \hlstd{=} \hlnum{1}\hlstd{)} \hlcom{#Outcome DCN}

\hlstd{hd} \hlkwb{<-} \hlkwd{expand.grid}\hlstd{(st, yt, sc, yc)}
\hlkwd{colnames}\hlstd{(hd)} \hlkwb{<-} \hlkwd{c}\hlstd{(}\hlstr{"st"}\hlstd{,} \hlstr{"yt"}\hlstd{,} \hlstr{"sc"}\hlstd{,} \hlstr{"yc"}\hlstd{)}
\hlstd{hd[,}\hlnum{1}\hlopt{:}\hlnum{4}\hlstd{]} \hlkwb{<-} \hlkwd{round}\hlstd{(hd[,}\hlnum{1}\hlopt{:}\hlnum{4}\hlstd{],} \hlkwc{digits} \hlstd{=} \hlnum{1}\hlstd{)}

\hlcom{# Add columns with values in the formulas:}

\hlstd{hd}\hlopt{$}\hlstd{f8a} \hlkwb{<-} \hlkwd{round}\hlstd{(}\hlkwd{with}\hlstd{(hd, ((}\hlnum{1}\hlopt{-}\hlstd{(yt}\hlopt{-}\hlstd{yc))}\hlopt{+} \hlcom{#big diff in Y}
                            \hlkwd{abs}\hlstd{(st}\hlopt{-}\hlstd{sc)}\hlopt{+} \hlcom{#small diff in s.}
                            \hlstd{(}\hlnum{1}\hlopt{-}\hlstd{st)}\hlopt{+}
                            \hlstd{(}\hlnum{1}\hlopt{-}\hlstd{sc)))} \hlcom{#large s}
                \hlstd{,} \hlkwc{digits} \hlstd{=} \hlnum{2}\hlstd{)}

\hlstd{hd}\hlopt{$}\hlstd{f8laba} \hlkwb{<-} \hlkwd{as.character}\hlstd{(hd}\hlopt{$}\hlstd{f8a)}
\hlstd{hd}\hlopt{$}\hlstd{f8a}\hlkwb{<-} \hlkwd{round}\hlstd{(hd}\hlopt{$}\hlstd{f8a,} \hlkwc{digits} \hlstd{=} \hlnum{2}\hlstd{)}
\end{alltt}
\end{kframe}
\end{knitrout}

\begin{knitrout}
\definecolor{shadecolor}{rgb}{0.969, 0.969, 0.969}\color{fgcolor}\begin{figure}[t]
\includegraphics[width=\maxwidth]{figure/typdcn-1} \caption[Typical-Deviant Consistency]{Typical-Deviant Consistency}\label{fig:typdcn1}
\end{figure}

\begin{figure}[t]
\includegraphics[width=\maxwidth]{figure/typdcn-2} \caption[Typical-Deviant Consistency]{Typical-Deviant Consistency}\label{fig:typdcn2}
\end{figure}


\end{knitrout}

\subsection{Deviant Coverage - IIR Cases}
\label{sec:dcviir}

The last relevant comparison discussed in the paper is the one between deviant coverage cases and IIR cases in the same truth table row. Since the formula for this comparison is mainly based on truth table memberhsip, the xy plots between the sufficient formula and the outcome will not be able to reflect some of the priciples implemented. Figures~\ref{fig:dcviir1}, ~\ref{fig:dcviir2}, ~\ref{fig:dcviir3}, and ~\ref{fig:dcviir4} show the test for these pairs keeping sufficient solution membership of the deviant coverage term fixed at 0 and 0.4, and the truth table row membership of the IIR case at 1. Within the same plot, as it is only the difference in outcome membership that is relevant to the formula, we can see that the bigger this gets, the smaller formula values become, with cases on the same horizontal line having the same formula value. Between plots, we notice that formula values also get smaller as the membership of the deviant coverage case in the outcome increases and as the truth table membership of this case increases. However, the last difference cannot be spotted by moves in the positions of the dot reflecting the deviant coverage case, but rather by looking at identical plots with respect to its position, but different truth table membership values.

\begin{knitrout}
\definecolor{shadecolor}{rgb}{0.969, 0.969, 0.969}\color{fgcolor}\begin{kframe}
\begin{alltt}
\hlcom{# Assume they all are in the same TT Row:}
\hlcom{# DCV: (F<0.5) & (Y>0.5) & (TT<=Y)}
\hlcom{# IIR: (S<0.5) & (Y<0.5)}


\hlstd{fc} \hlkwb{<-} \hlkwd{round}\hlstd{(}\hlkwd{seq}\hlstd{(}\hlnum{0}\hlstd{,} \hlnum{0.4}\hlstd{,} \hlnum{0.1}\hlstd{),} \hlkwc{digits} \hlstd{=} \hlnum{1}\hlstd{)} \hlcom{#Formula membership DCV}
\hlstd{yc} \hlkwb{<-}  \hlkwd{round}\hlstd{(}\hlkwd{seq}\hlstd{(}\hlnum{0.6}\hlstd{,} \hlnum{1}\hlstd{,} \hlnum{0.1}\hlstd{),} \hlkwc{digits} \hlstd{=} \hlnum{1}\hlstd{)} \hlcom{#Outcome DCV}
\hlstd{ttc} \hlkwb{<-} \hlkwd{round}\hlstd{(}\hlkwd{seq}\hlstd{(}\hlnum{0.6}\hlstd{,} \hlnum{1}\hlstd{,} \hlnum{0.1}\hlstd{),} \hlkwc{digits} \hlstd{=} \hlnum{1}\hlstd{)} \hlcom{#TT membership DCV}
\hlstd{si} \hlkwb{<-} \hlkwd{round}\hlstd{(}\hlkwd{seq}\hlstd{(}\hlnum{0}\hlstd{,} \hlnum{0.4}\hlstd{,} \hlnum{0.1}\hlstd{),} \hlkwc{digits} \hlstd{=} \hlnum{1}\hlstd{)} \hlcom{#Formula membership IIR}
\hlstd{yi} \hlkwb{<-} \hlkwd{round}\hlstd{(}\hlkwd{seq}\hlstd{(}\hlnum{0}\hlstd{,} \hlnum{0.4}\hlstd{,} \hlnum{0.1}\hlstd{),} \hlkwc{digits} \hlstd{=} \hlnum{1}\hlstd{)} \hlcom{#Outcome IIR}
\hlstd{tti} \hlkwb{<-} \hlkwd{round}\hlstd{(}\hlkwd{seq}\hlstd{(}\hlnum{0.6}\hlstd{,} \hlnum{1}\hlstd{,} \hlnum{0.1}\hlstd{),} \hlkwc{digits} \hlstd{=} \hlnum{1}\hlstd{)} \hlcom{#TT membership DCV}

\hlstd{hd} \hlkwb{<-} \hlkwd{expand.grid}\hlstd{(fc, yc, ttc, si, yi, tti)}
\hlkwd{colnames}\hlstd{(hd)} \hlkwb{<-} \hlkwd{c}\hlstd{(}\hlstr{"fc"}\hlstd{,} \hlstr{"yc"}\hlstd{,} \hlstr{"ttc"}\hlstd{,} \hlstr{"si"}\hlstd{,}\hlstr{"yi"}\hlstd{,}\hlstr{"tti"}\hlstd{)}
\hlstd{hd[,}\hlnum{1}\hlopt{:}\hlnum{6}\hlstd{]} \hlkwb{<-} \hlkwd{round}\hlstd{(hd[,}\hlnum{1}\hlopt{:}\hlnum{6}\hlstd{],} \hlkwc{digits} \hlstd{=} \hlnum{1}\hlstd{)}

\hlcom{# Add columns with values in the formulas:}
\hlstd{hd}\hlopt{$}\hlstd{f8a} \hlkwb{<-} \hlkwd{round}\hlstd{(}\hlkwd{with}\hlstd{(hd, ((}\hlnum{1}\hlopt{-}\hlstd{(yc}\hlopt{-}\hlstd{yi))}\hlopt{+} \hlcom{#big diff in Y}
                            \hlkwd{abs}\hlstd{(ttc}\hlopt{-}\hlstd{tti)}\hlopt{+} \hlcom{#small diff in TT.}
                            \hlstd{(}\hlnum{1}\hlopt{-}\hlstd{ttc)}\hlopt{+}
                            \hlstd{(}\hlnum{1}\hlopt{-}\hlstd{tti)))} \hlcom{#large TT}
                \hlstd{,} \hlkwc{digits} \hlstd{=} \hlnum{2}\hlstd{)}

\hlstd{hd}\hlopt{$}\hlstd{f8laba} \hlkwb{<-} \hlkwd{as.character}\hlstd{(hd}\hlopt{$}\hlstd{f8a)}
\hlstd{hd}\hlopt{$}\hlstd{f8a}\hlkwb{<-} \hlkwd{round}\hlstd{(hd}\hlopt{$}\hlstd{f8a,} \hlkwc{digits} \hlstd{=} \hlnum{2}\hlstd{)}
\end{alltt}
\end{kframe}
\end{knitrout}

\begin{knitrout}
\definecolor{shadecolor}{rgb}{0.969, 0.969, 0.969}\color{fgcolor}\begin{figure}[t]
\includegraphics[width=\maxwidth]{figure/dcviir-1} \caption[Deviant Coverage-IIR]{Deviant Coverage-IIR}\label{fig:dcviir1}
\end{figure}

\begin{figure}[t]
\includegraphics[width=\maxwidth]{figure/dcviir-2} \caption[Deviant Coverage-IIR]{Deviant Coverage-IIR}\label{fig:dcviir2}
\end{figure}

\begin{figure}[t]
\includegraphics[width=\maxwidth]{figure/dcviir-3} \caption[Deviant Coverage-IIR]{Deviant Coverage-IIR}\label{fig:dcviir3}
\end{figure}

\begin{figure}[t]
\includegraphics[width=\maxwidth]{figure/dcviir-4} \caption[Deviant Coverage-IIR]{Deviant Coverage-IIR}\label{fig:dcviir4}
\end{figure}


\end{knitrout}

\end{document}
